<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <title>创建类和对象</title>
</head>

<body>
  <script type="text/javascript">
    class Star {
      constructor(uname, age) {
        this.uname = uname
        this.age = age
      }
      sing(sing) {
        console.log(sing);
      }
    }

    let ldh = new Star('刘德华', 20)
    let zxy = new Star('张学友', 18)
    console.log(ldh);
    console.log(ldh);
    console.log(ldh.constructor);
    console.log(ldh.prototype);
    console.log(ldh.__proto__ === Star.prototype); //true
    console.log(zxy);
    ldh.sing("冰雨")
    zxy.sing("李香兰")
  </script>

</body>

</html>